package com.sf.dlb.service;

import com.sf.dlb.controller.CmsNewListController;
import com.sf.dlb.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

/**
 * Created by tanjing on 2019/5/21.
 */
@Service
public class ScheduledTaskService {
    private static Logger logger = LoggerFactory.getLogger(CmsNewListController.class);
    @Autowired
    private NewListService newListService;
    @Autowired
    private VideoListService videoListService;

    @Scheduled(cron="0 0/2 * * * ?")
    public void scheduledTask(){
        logger.info("scheduledTask start time == "+ DateUtils.getDateTime());
        newListService.getNewList();
        videoListService.getVideoList();
        logger.info("scheduledTask end time == "+DateUtils.getDateTime());
    }
}
